package 栈算法;

import org.junit.Test;

public class dailyTemperatures739 {
    /**
     * @param temperatures
     * @return
     */
    public int[] dailyTemperatures(int[] temperatures) {
        int[] result = new int[temperatures.length];
        int index = 0;

        for (int i = 0; i < result.length; i++) {
            boolean flag = false;
            for (int j = i + 1; j < result.length; j++) {
                if (temperatures[j] > temperatures[i]) {
                    result[index++] = j - i;
                    flag = true;
                    break;
                }
            }
            if (!flag) {
                index++;
            }
        }
        return result;
    }

    @Test
    public void test() {
        int[] ints = {30, 60, 90};
        int[] ints1 = dailyTemperatures(ints);
    }
}
